<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/vue-2.6.10.js"></script>
</head>
<body>
<div id="app">
    <button v-on:click="num++">增加</button>
    <button @click="decrement">减少</button>
    <h2>
        num = {{num}}
    </h2>

    <hr>

    <div style="background-color: pink; width:100px;height: 100px" @click="print('fff')">
        <button @click="print('2bff')">点我</button>
    </div>
    <br>
    <a href="www.baidu.com" @click.prevent="print('fffffsss')">用力</a>
</div>
<script type="text/javascript">
    new Vue({
        el: "#app",
        data: {
            num:1
        },
        methods:{
            decrement (){
                this.num--;
            },
            print(str){
                console.log(str)
            }
        }
    });
</script>
</body>
</html>